export {};

// const PostStatus = {
//     Draft: 0,
//     Unpublished: 1,
//     Published: 2
// };

// 默认值为从 0 开始的自增长数字
enum PostStatus {
    Draft,
    Unpublished,
    Published
};

console.log(PostStatus.Draft, PostStatus.Unpublished, PostStatus.Published);


// 可以自定义值, 此时所有枚举的值都需要自定义(使用 = )
enum PostStatus1 {
    Draft = 'aaa',
    Unpublished = 'bbb',
    Published = 'ccc'
};

console.log(PostStatus1.Draft, PostStatus1.Unpublished, PostStatus1.Published);

// 在 enum 前添加 const 会将其编译为常量枚举, 枚举变量会被注释

const enum PostStatus2 {
    Draft = 'aaa',
    Unpublished = 'bbb',
    Published = 'ccc'
};

console.log(PostStatus2.Draft, PostStatus2.Unpublished, PostStatus2.Published);
// console.log("aaa" /* Draft */, "bbb" /* Unpublished */, "ccc" /* Published */);







